package com.yjck.fm.login.dao.impl;

import com.yjck.fm.login.bean.User;
import com.yjck.fm.login.dao.RegisterDAO;
import com.yjck.fm.util.DBUtil;

public class RegisterDAOImpl implements RegisterDAO {
	private DBUtil dbUtil;


	public void setDbUtil(DBUtil dbUtil) {
		this.dbUtil = dbUtil;
	}


	public boolean register(User user) {
		String sql = "INSERT into user(email,passwd,sex,address,birthday,safequestion,saferesult) VALUES (?,?,?,?,?,?,?)";
		Object params[] = {
				user.getEmail(),
				user.getPasswd(),
				user.getSex(),
				user.getAddress(),
				user.getBirthday(),
				user.getSafeQuestion(),
				user.getSafeResult()
		};
		int flag = dbUtil.execUpdate(sql, params);
		if(flag > 0){
			return true;
		}
		return false;
	}

}
